headerbar: simplify calculation in size allocation code
authorRay Strode <rstrode@redhat.com>
Thu, 23 Jun 2016 20:31:24 +0000 (16:31 -0400)
committerRay Strode <rstrode@redhat.com>
Sat, 25 Jun 2016 00:19:32 +0000 (20:19 -0400)
There's some extraneous MIN() calls that have predetermined answers.

This commit drops them and then simplifies a few redudant checks into
one MIN call.

https://bugzilla.gnome.org/show_bug.cgi?id=724332

gtk/gtkheaderbar.c

index fb427d163a65aa83ebf5d2570c8982032ed11396..c16cf8a6ab5a5ec009da5fb7a476e74291485639 100644 (file)
@@ -1133,14 +1133,7 @@ gtk_header_bar_allocate_contents (GtkCssGadget        *gadget,
   child_allocation.y = allocation->y;
   child_allocation.height = allocation->height;
 
-  width = MAX (side[0], side[1]);
-
-  if (allocation->width - 2 * width >= title_natural_size)
-    child_size = MIN (title_natural_size, allocation->width - 2 * width);
-  else if (allocation->width - side[0] - side[1] >= title_natural_size)
-    child_size = MIN (title_natural_size, allocation->width - side[0] - side[1]);
-  else
-    child_size = allocation->width - side[0] - side[1];
+  child_size = MIN (allocation->width - side[0] - side[1], title_natural_size);
 
   child_allocation.x = allocation->x + (allocation->width - child_size) / 2;
   child_allocation.width = child_size;